<template>
  <block v-for="(item,index) in list" :key="index">
    <house-item page="/" :item="item" customStyle="background:#fff;margin:20rpx;" :imageWidth="234" imageHeight="192">
      <template #right>
        <view class="u-flex-between u-flex-column u-flex-fill">
          <view class="house-name">
            {{item.title}}
          </view>
          <view class="house-desc" v-if="item.description">“{{item.description}}”</view>
          <view class="house-info">“{{item.space}}㎡ | {{item.house_type_text}}”</view>
          <view class="house-price u-flex-y-center u-flex-between">
            <text>市场价：{{item.market_price}}万</text>
            <text>优惠价：{{item.price}}万</text>
          </view>
        </view>
      </template>
    </house-item>
  </block>
</template>

<script setup>
  import { visit_lst } from '../../config/api';
  import houseItem from '@/components/house-item/house-item.vue';
  import { onMounted, ref } from "vue"
  import { onReachBottom } from '@dcloudio/uni-app'
  const params = ref({
    page: 1,
    limit: 15
  })
  const list = ref([])
  onMounted(() => {
    _visit_lst()
  })
  onReachBottom(() => {
    params.value.page++
    _visit_lst()
  })
  // 浏览记录
  const _visit_lst = () => {
    visit_lst().then(res => {
      if (params.value.page == 1) list.value = res.data
      else list.value = list.value.concat(res.data)
    })
  }
</script>

<style lang="scss" scoped>
  .house-name {
    font-size: 26rpx;
    color: #333;
    font-weight: 800;
  }

  .house-info {
    font-size: 24rpx;
    font-weight: 500;
    color: #666;
  }

  .house-desc {
    font-size: 22rpx;
    color: #E47117;
  }

  .house-price {
    color: #DF0F0F;
    font-weight: 800;
    font-size: 24rpx;
  }
</style>